<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>tdl.event.App</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="tdl-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/python-tdl/">python-tdl</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="tdl-module.html">Package&nbsp;tdl</a> ::
        <a href="tdl.event-module.html">Module&nbsp;event</a> ::
        Class&nbsp;App
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="tdl.event.App-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class App</h1><p class="nomargin-top"><span class="codelink"><a href="tdl.event-pysrc.html#App">source&nbsp;code</a></span></p>
<pre class="base-tree">
object --+
         |
        <strong class="uidshort">App</strong>
</pre>

<hr />
<p>Application framework.</p>
  <ul>
    <li>
      ev_*: Events are passed to methods based on their <a 
      href="tdl.event.Event-class.html#type" class="link">Event.type</a> 
      attribute. If an event type is 'KEYDOWN' the ev_KEYDOWN method will 
      be called with the event instance as a parameter.
    </li>
    <li>
      key_*: When a key is pressed another method will be called based on 
      the keyname attribute.  For example the 'ENTER' keyname will call 
      key_ENTER with the associated <a href="tdl.event.KeyDown-class.html" 
      class="link">KeyDown</a> event as its parameter.
    </li>
    <li>
      <a href="tdl.event.App-class.html#update" class="link">update</a>: 
      This method is called every loop before making a call to <a 
      href="tdl-module.html#flush" class="link">tdl.flush</a>.  It is 
      passed a single parameter detailing the time in seconds since the 
      last update (often known as deltaTime.)
    </li>
  </ul>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Methods</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_QUIT"></a><span class="summary-sig-name">ev_QUIT</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Unless overridden this method raises a SystemExit exception closing 
      the program.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_QUIT">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_KEYDOWN"></a><span class="summary-sig-name">ev_KEYDOWN</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Override this method to handle a <a 
      href="tdl.event.KeyDown-class.html" class="link">KeyDown</a> event.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_KEYDOWN">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_KEYUP"></a><span class="summary-sig-name">ev_KEYUP</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Override this method to handle a <a href="tdl.event.KeyUp-class.html"
      class="link">KeyUp</a> event.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_KEYUP">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_MOUSEDOWN"></a><span class="summary-sig-name">ev_MOUSEDOWN</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Override this method to handle a <a 
      href="tdl.event.MouseDown-class.html" class="link">MouseDown</a> 
      event.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_MOUSEDOWN">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_MOUSEUP"></a><span class="summary-sig-name">ev_MOUSEUP</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Override this method to handle a <a 
      href="tdl.event.MouseUp-class.html" class="link">MouseUp</a> event.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_MOUSEUP">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="ev_MOUSEMOTION"></a><span class="summary-sig-name">ev_MOUSEMOTION</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">event</span>)</span><br />
      Override this method to handle a <a 
      href="tdl.event.MouseMotion-class.html" class="link">MouseMotion</a> 
      event.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.ev_MOUSEMOTION">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="tdl.event.App-class.html#update" class="summary-sig-name">update</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">deltaTime</span>)</span><br />
      Override this method to handle per frame logic and drawing.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.update">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="tdl.event.App-class.html#suspend" class="summary-sig-name">suspend</a>(<span class="summary-sig-arg">self</span>)</span><br />
      When called the App will begin to return control to where <a 
      href="tdl.event.App-class.html#run" class="link">App.run</a> was 
      called.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.suspend">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="tdl.event.App-class.html#run" class="summary-sig-name">run</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Delegate control over to this App instance.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.run">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="tdl.event.App-class.html#runOnce" class="summary-sig-name">runOnce</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Pump events to this App instance and then return.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="tdl.event-pysrc.html#App.runOnce">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__init__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__sizeof__</code>,
      <code>__str__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Properties</span></td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Method Details</span></td>
</tr>
</table>
<a name="update"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">update</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">deltaTime</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="tdl.event-pysrc.html#App.update">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Override this method to handle per frame logic and drawing.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>deltaTime</code></strong> (float) - This parameter tells the amount of time passed since the last 
          call measured in seconds as a floating point number.
          <p>You can use this variable to make your program frame rate 
          independent.  Use this parameter to adjust the speed of physics, 
          special visual effects, and other game logic.</p></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="suspend"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">suspend</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="tdl.event-pysrc.html#App.suspend">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>When called the App will begin to return control to where <a 
  href="tdl.event.App-class.html#run" class="link">App.run</a> was 
  called.</p>
  <p>Some further events are processed and the <a 
  href="tdl.event.App-class.html#update" class="link">App.update</a> method
  will be called one last time before exiting (unless suspended during a 
  call to <a href="tdl.event.App-class.html#update" 
  class="link">App.update</a>.)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="run"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">run</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="tdl.event-pysrc.html#App.run">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Delegate control over to this App instance.  This function will 
  process all events and send them to the special methods ev_* and 
  key_*.</p>
  <p>A call to <a href="tdl.event.App-class.html#suspend" 
  class="link">App.suspend</a> will return the control flow back to where 
  this function is called.  And then the App can be run again. But a single
  App instance can not be run multiple times simultaneously.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="runOnce"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">runOnce</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="tdl.event-pysrc.html#App.runOnce">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Pump events to this App instance and then return.</p>
  <p>This works in the way described in <a 
  href="tdl.event.App-class.html#run" class="link">App.run</a> except it 
  immediately returns after the first <a 
  href="tdl.event.App-class.html#update" class="link">update</a> call.</p>
  <p>Having multiple <a href="tdl.event.App-class.html" 
  class="link">App</a> instances and selectively calling runOnce on them is
  a decent way to create a state machine.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="tdl-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/python-tdl/">python-tdl</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    <a href="epydoc-log.html">Generated by Epydoc
    3.0.1 on Wed Dec 05 20:07:32 2012</a>
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
